﻿using blackhouse.WebNemo.Business.Groups;
using System;
using System.Web.UI;

namespace blackhouse.WebNemo.Web.Controls
{
    public abstract class DisplayRecordValue : Control {

		#region Fields

		protected GroupColumn column;
        protected GroupRecord record;

		#endregion

		protected DisplayRecordValue(){}

        public virtual bool IsEmpty()
        {
            return this.record.IsNull(this.column.SelectColumnName);
        }

        protected abstract void PopulateControl();
        public void SetControl(GroupColumn column, GroupRecord record)
        {
            this.column = column;
            this.record = record;
            if (!(((this.column == null) || (this.record == null)) || this.IsEmpty()))
            {
                this.Visible = true;
                this.PopulateControl();
            }
            else
            {
                this.Visible = false;
            }
        }
    }
}

